package com.clark.dingding.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.clark.dingding.interfaces.NewsItemClickCallBack
import com.clark.dingding.model.NewsData
import com.linkage.linkedlife.R
import com.linkage.linkedlife.databinding.ItemNewsBinding
import io.reactivex.internal.schedulers.NewThreadScheduler

/**
 * @ClassName: AdapterNews
 * @Description:
 * @Author: Clark
 * @Date: 2020/12/16 0016 9:32
 */

class AdapterNews(var newsItemClickCallBack: NewsItemClickCallBack) :
    BaseQuickAdapter<NewsData.ResultBean, BaseDataBindingHolder<ItemNewsBinding>>(R.layout.item_news) {
    override fun convert(
        holder: BaseDataBindingHolder<ItemNewsBinding>,
        item: NewsData.ResultBean
    ) {
        var binding = holder.dataBinding;
        if (binding != null) {
            binding.newContent.text = item.desc
            binding.newAuthor.text = item.who
            binding.callback = newsItemClickCallBack
        }
    }
}